package com.cj.st.util;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

public class PasswordUtil {

    public static String getPassword(String userName, String password, String salt) {
        byte[] credentials = password.getBytes();
        ByteSource credentialsSalt = ByteSource.Util.bytes(userName + salt);
        SimpleHash obj = new SimpleHash(Consts.hashAlgorithmName, credentials, credentialsSalt, Consts.hashIterations);
        return obj.toHex();
    }
}
